<!--
Copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
-->
<!-- boost-no-inspect -->
<!-- HTML header for doxygen 1.8.9.1-->
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
<meta http-equiv="X-UA-Compatible" content="IE=9"/>
<meta name="generator" content="Doxygen 1.9.1"/>
<title>Boost.Hana: boost::hana::embedding&lt; bool &gt; Struct Template Reference</title>
<link href="tabs.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="dynsections.js"></script>
<link href="navtree.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="resize.js"></script>
<script type="text/javascript" src="navtreedata.js"></script>
<script type="text/javascript" src="navtree.js"></script>
<link href="search/search.css" rel="stylesheet" type="text/css"/>
<script type="text/javascript" src="search/searchdata.js"></script>
<script type="text/javascript" src="search/search.js"></script>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
  $(document).ready(function() { init_search(); });
/* @license-end */
</script>
<script type="text/x-mathjax-config">
  MathJax.Hub.Config({
    extensions: ["tex2jax.js"],
    jax: ["input/TeX","output/HTML-CSS"],
});
// Copyright Louis Dionne 2013-2017
// Distributed under the Boost Software License, Version 1.0.
// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
MathJax.Hub.Config({
    "HTML-CSS": {
        linebreaks: {
            automatic: true,
            width: "75% container"
        }
    }
});
</script>
<script type="text/javascript" async="async" src="https://cdn.mathjax.org/mathjax/latest/MathJax.js"></script>
<link href="doxygen.css" rel="stylesheet" type="text/css" />
<!-- Additional javascript for drawing charts. -->
<script type="text/javascript" src="highcharts.js"></script>
<script type="text/javascript" src="highcharts-data.js"></script>
<script type="text/javascript" src="highcharts-exporting.js"></script>
<script type="text/javascript" src="chart.js"></script>
<script type="text/javascript" src="hana.js"></script>
</head>
<body>
<div id="top"><!-- do not remove this div, it is closed by doxygen! -->
<div id="titlearea">
<table cellspacing="0" cellpadding="0">
 <tbody>
 <tr style="height: 56px;">
  <td id="projectlogo"><img alt="Logo" src="Boost.png"/></td>
  <td style="padding-left: 0.5em;">
   <div id="projectname">Boost.Hana
   &#160;<span id="projectnumber">1.7.1</span>
   </div>
   <div id="projectbrief">Your standard library for metaprogramming</div>
  </td>
   <td>        <div id="MSearchBox" class="MSearchBoxInactive">
        <span class="left">
          <img id="MSearchSelect" src="search/mag_sel.svg"
               onmouseover="return searchBox.OnSearchSelectShow()"
               onmouseout="return searchBox.OnSearchSelectHide()"
               alt=""/>
          <input type="text" id="MSearchField" value="Search" accesskey="S"
               onfocus="searchBox.OnSearchFieldFocus(true)" 
               onblur="searchBox.OnSearchFieldFocus(false)" 
               onkeyup="searchBox.OnSearchFieldChange(event)"/>
          </span><span class="right">
            <a id="MSearchClose" href="javascript:searchBox.CloseResultsWindow()"><img id="MSearchCloseImg" border="0" src="search/close.svg" alt=""/></a>
          </span>
        </div>
</td>
 </tr>
 </tbody>
</table>
</div>
<!-- end header part -->
<!-- Generated by Doxygen 1.9.1 -->
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
var searchBox = new SearchBox("searchBox", "search",false,'Search','.html');
/* @license-end */
</script>
</div><!-- top -->
<div id="side-nav" class="ui-resizable side-nav-resizable">
  <div id="nav-tree">
    <div id="nav-tree-contents">
      <div id="nav-sync" class="sync"></div>
    </div>
  </div>
  <div id="splitbar" style="-moz-user-select:none;" 
       class="ui-resizable-handle">
  </div>
</div>
<script type="text/javascript">
/* @license magnet:?xt=urn:btih:cf05388f2679ee054f2beb29a391d25f4e673ac3&amp;dn=gpl-2.0.txt GPL-v2 */
$(document).ready(function(){initNavTree('structboost_1_1hana_1_1embedding.html',''); initResizable(); });
/* @license-end */
</script>
<div id="doc-content">
<!-- window showing the filter options -->
<div id="MSearchSelectWindow"
     onmouseover="return searchBox.OnSearchSelectShow()"
     onmouseout="return searchBox.OnSearchSelectHide()"
     onkeydown="return searchBox.OnSearchSelectKey(event)">
</div>

<!-- iframe showing the search results (closed by default) -->
<div id="MSearchResultsWindow">
<iframe src="javascript:void(0)" frameborder="0" 
        name="MSearchResults" id="MSearchResults">
</iframe>
</div>

<div class="header">
  <div class="headertitle">
<div class="title">boost::hana::embedding&lt; bool &gt; Struct Template Reference<div class="ingroups"><a class="el" href="group__group-core.html">Core</a></div></div>  </div>
</div><!--header-->
<div class="contents">
<a name="details" id="details"></a><h2 class="groupheader">Description</h2>
<div class="textblock"><h3>template&lt;bool = true&gt;<br />
struct boost::hana::embedding&lt; bool &gt;</h3>

<p>Marks a conversion between data types as being an embedding. </p>
<p>To mark a conversion between two data types <code>To</code> and <code>From</code> as an embedding, simply use <code>embedding&lt;true&gt;</code> (or simply <code>embedding&lt;&gt;</code>) as a base class of the corresponding <code>to_impl</code> specialization. If a <code>to_impl</code> specialization does not inherit <code>embedding&lt;true&gt;</code> or <code>embedding&lt;&gt;</code>, then it is not considered an embedding by the <code><a class="el" href="structboost_1_1hana_1_1is__embedded.html" title="Returns whether a data type can be embedded into another data type.">is_embedded</a></code> metafunction.</p>
<blockquote class="doxtable">
<p>#### Tip The boolean template parameter is useful for marking a conversion as an embedding only when some condition is satisfied. </p>
</blockquote>
<h2><a class="anchor" id="autotoc_md194"></a>
Example</h2>
<div class="fragment"><div class="line"><span class="comment">// Copyright Louis Dionne 2013-2017</span></div>
<div class="line"><span class="comment">// Distributed under the Boost Software License, Version 1.0.</span></div>
<div class="line"><span class="comment">// (See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="assert_8hpp.html">boost/hana/assert.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="core_2to_8hpp.html">boost/hana/core/to.hpp</a>&gt;</span></div>
<div class="line"><span class="preprocessor">#include &lt;<a class="code" href="core_2when_8hpp.html">boost/hana/core/when.hpp</a>&gt;</span></div>
<div class="line"> </div>
<div class="line"><span class="preprocessor">#include &lt;vector&gt;</span></div>
<div class="line"><span class="keyword">namespace </span>hana = <a class="code" href="namespaceboost_1_1hana.html">boost::hana</a>;</div>
<div class="line"> </div>
<div class="line"> </div>
<div class="line"><span class="keyword">namespace </span>boost { <span class="keyword">namespace </span>hana {</div>
<div class="line">    <span class="keyword">template</span> &lt;<span class="keyword">typename</span> To, <span class="keyword">typename</span> From&gt;</div>
<div class="line">    <span class="keyword">struct </span>to_impl&lt;std::vector&lt;To&gt;, std::vector&lt;From&gt;,</div>
<div class="line">        when&lt;is_convertible&lt;From, To&gt;::value&gt;&gt;</div>
<div class="line">        : embedding&lt;is_embedded&lt;From, To&gt;::value&gt;</div>
<div class="line">    {</div>
<div class="line">        <span class="keyword">static</span> std::vector&lt;To&gt; <a class="code" href="group__group-functional.html#ga30027c383676084be151ef3c6cf2829f">apply</a>(std::vector&lt;From&gt; <span class="keyword">const</span>&amp; xs) {</div>
<div class="line">            std::vector&lt;To&gt; result;</div>
<div class="line">            <span class="keywordflow">for</span> (<span class="keyword">auto</span> <span class="keyword">const</span>&amp; x: xs)</div>
<div class="line">                result.push_back(to&lt;To&gt;(x));</div>
<div class="line">            <span class="keywordflow">return</span> result;</div>
<div class="line">        }</div>
<div class="line">    };</div>
<div class="line">}}</div>
<div class="line"> </div>
<div class="line"><span class="keywordtype">int</span> main() {</div>
<div class="line">    <a class="code" href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a>(</div>
<div class="line">        <a class="code" href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e">hana::to</a>&lt;std::vector&lt;int&gt;&gt;(std::vector&lt;float&gt;{1.1, 2.2, 3.3})</div>
<div class="line">                        ==</div>
<div class="line">        std::vector&lt;int&gt;{1, 2, 3}</div>
<div class="line">    );</div>
<div class="line"> </div>
<div class="line">    static_assert(!hana::is_embedded&lt;std::vector&lt;float&gt;, std::vector&lt;int&gt;&gt;{}, <span class="stringliteral">&quot;&quot;</span>);</div>
<div class="line">}</div>
<div class="ttc" id="aassert_8hpp_html"><div class="ttname"><a href="assert_8hpp.html">assert.hpp</a></div><div class="ttdoc">Defines macros to perform different kinds of assertions.</div></div>
<div class="ttc" id="acore_2to_8hpp_html"><div class="ttname"><a href="core_2to_8hpp.html">to.hpp</a></div><div class="ttdoc">Defines boost::hana::to and related utilities.</div></div>
<div class="ttc" id="acore_2when_8hpp_html"><div class="ttname"><a href="core_2when_8hpp.html">when.hpp</a></div><div class="ttdoc">Defines boost::hana::when and boost::hana::when_valid.</div></div>
<div class="ttc" id="agroup__group-assertions_html_ga4796ae107d58b67e0bbccd5ae6f70101"><div class="ttname"><a href="group__group-assertions.html#ga4796ae107d58b67e0bbccd5ae6f70101">BOOST_HANA_RUNTIME_CHECK</a></div><div class="ttdeci">#define BOOST_HANA_RUNTIME_CHECK(...)</div><div class="ttdoc">Equivalent to BOOST_HANA_RUNTIME_ASSERT, but not influenced by the BOOST_HANA_CONFIG_DISABLE_ASSERTIO...</div><div class="ttdef"><b>Definition:</b> assert.hpp:209</div></div>
<div class="ttc" id="agroup__group-core_html_gadc70755c1d059139297814fb3bfeb91e"><div class="ttname"><a href="group__group-core.html#gadc70755c1d059139297814fb3bfeb91e">boost::hana::to</a></div><div class="ttdeci">constexpr auto to</div><div class="ttdoc">Converts an object from one data type to another.</div><div class="ttdef"><b>Definition:</b> to.hpp:97</div></div>
<div class="ttc" id="agroup__group-functional_html_ga30027c383676084be151ef3c6cf2829f"><div class="ttname"><a href="group__group-functional.html#ga30027c383676084be151ef3c6cf2829f">boost::hana::apply</a></div><div class="ttdeci">constexpr auto apply</div><div class="ttdoc">Invokes a Callable with the given arguments.</div><div class="ttdef"><b>Definition:</b> apply.hpp:40</div></div>
<div class="ttc" id="anamespaceboost_1_1hana_html"><div class="ttname"><a href="namespaceboost_1_1hana.html">boost::hana</a></div><div class="ttdoc">Namespace containing everything in the library.</div><div class="ttdef"><b>Definition:</b> accessors.hpp:20</div></div>
</div><!-- fragment --> </div>
<p>Inherited by boost::hana::to_impl&lt; T *, decltype(nullptr)&gt;, boost::hana::to_impl&lt; To, To &gt;, boost::hana::to_impl&lt; detail::copy_char_signedness&lt; int &gt;::type, char &gt;, boost::hana::to_impl&lt; detail::copy_char_signedness&lt; long &gt;::type, char &gt;, boost::hana::to_impl&lt; detail::copy_char_signedness&lt; long long &gt;::type, char &gt;, boost::hana::to_impl&lt; detail::copy_char_signedness&lt; short &gt;::type, char &gt;, boost::hana::to_impl&lt; double, float &gt;, boost::hana::to_impl&lt; long double, double &gt;, boost::hana::to_impl&lt; long double, float &gt;, boost::hana::to_impl&lt; signed int, signed char &gt;, boost::hana::to_impl&lt; signed int, signed short &gt;, boost::hana::to_impl&lt; signed long long, signed char &gt;, boost::hana::to_impl&lt; signed long long, signed int &gt;, boost::hana::to_impl&lt; signed long long, signed long &gt;, boost::hana::to_impl&lt; signed long long, signed short &gt;, boost::hana::to_impl&lt; signed long, signed char &gt;, boost::hana::to_impl&lt; signed long, signed int &gt;, boost::hana::to_impl&lt; signed long, signed short &gt;, boost::hana::to_impl&lt; signed short, signed char &gt;, boost::hana::to_impl&lt; unsigned int, unsigned char &gt;, boost::hana::to_impl&lt; unsigned int, unsigned short &gt;, boost::hana::to_impl&lt; unsigned long long, unsigned char &gt;, boost::hana::to_impl&lt; unsigned long long, unsigned int &gt;, boost::hana::to_impl&lt; unsigned long long, unsigned long &gt;, boost::hana::to_impl&lt; unsigned long long, unsigned short &gt;, boost::hana::to_impl&lt; unsigned long, unsigned char &gt;, boost::hana::to_impl&lt; unsigned long, unsigned int &gt;, boost::hana::to_impl&lt; unsigned long, unsigned short &gt;, and boost::hana::to_impl&lt; unsigned short, unsigned char &gt;.</p>
</div><!-- contents -->
</div><!-- doc-content -->
<!--
Copyright Louis Dionne 2013-2017
Distributed under the Boost Software License, Version 1.0.
(See accompanying file LICENSE.md or copy at http://boost.org/LICENSE_1_0.txt)
-->
<!-- boost-no-inspect -->
<!-- HTML footer for doxygen 1.8.9.1-->
<!-- start footer part -->
<div id="nav-path" class="navpath"><!-- id is needed for treeview function! -->
  <ul>
    <li class="navelem"><b>boost</b></li><li class="navelem"><a class="el" href="namespaceboost_1_1hana.html">hana</a></li><li class="navelem"><a class="el" href="structboost_1_1hana_1_1embedding.html">embedding</a></li>
  </ul>
</div>
</body>
</html>
